package basic.java.exception.ecxeptionerror;

/**
 * @创建人 MBY381
 * @创建时间 2022/4/26 17:35
 * @描述 暂无
 */
public class ExceptionCa {
    public static void main(String[] args) {
//        test1();
        test2();


    }
    public static void test2(){
        try {
            test(1,0);
        }catch (Exception e){
            e.printStackTrace();
        }
        System.out.println("wdnmd");
    }
    public static int test(int a, int b) throws Exception {
        if(b==0){
            throw new Exception("0不能作除数！");
        }
        return a/b;
    }
    public static void test1(){
        int[] a=new int[227];
        try {
            a[227]=3;
        }catch (IndexOutOfBoundsException|NullPointerException e){ //可用或
            e.printStackTrace();
        }
        System.out.println("wdnmd 227");
    }
}
